<extend name="Base/base" />
<block name='head'>
    <link rel="stylesheet" href="/Public/Index/css/plan/plan_details.css" media="screen" type="text/css" />
    <link rel="stylesheet" href="/Public/Admin/css/personal.css"/>
    <link rel="stylesheet" href="/Public/Admin/css/main.css"/>
    <script src="/Public/static/layer/layer.js"></script>
    <!--文件上传-->
    <script type="text/javascript" src="/Public/Cropper/js/ajaxfileupload.js" ></script>
    <style>
        table{
            width:100%;
            border-collapse: collapse;
            margin:1rem auto;
            /*margin-top: 1rem;*/
        }
        table tr td{
            border:1px solid #CFDDEA;
            padding:0.3em 0;
            text-align: center;
        }
        table .value{
            width:80%;
            text-align: left;
            padding-left:10px;
        }
        table .key{
            width:20%;
            text-align: center;
            background: #F0F3F7;
            color:#333;
            font-size:14px;
            font-weight: bold;
        }
        table{background:#fff}
        .button{margin-top:2em}
        .plan-more tr{line-height: 2em}
        .adrme {margin-top:10px;}
        .write{padding:0}
        h2{padding:0;}
        .detail-content h2{font-size:15px;margin-bottom: 38px;}
        .file{background:url("/Public/Admin/images/file.png") no-repeat left top;padding-left: 28px;}
    </style>
</block>
<block name="content"> 
    <section class="layui-larry-box">
        <div class="larry-personal workPlanDetail-page">
            <div class="layui-tab">
                <p class="nav-title">
                    <a class="newsAdd_btn goback" title="返回" data-path="{$path|default=''}" href="javascript:window.location.href = document.referrer;"><img src="/Public/Admin/images/back.png" /></a>
                    <a class="planlist" href="{:U('Plan/index')}"><span>计划列表</span></a> &nbsp;> &nbsp;计划详情
                    <input type="hidden" id="type" value="{$type}" />
                    <!--返回参数-->
                <form action="{:U('index')}" id="form" method="get">
                    <input type="hidden" name="pType" value="{$pType}" />
                    <input type="hidden" name="level" value="{$level}" />
                    <input type="hidden" name="sms_flag" value="{$smsFlag}" />
                    <input type="hidden" name="plan_name" value="{$planName}" />
                    <input type="hidden" name="start" value="{$start}" />
                    <input type="hidden" name="end" value="{$end}" />
                    <input type="hidden" name="to_id" value="{$deptName}" />
                    <input type="hidden" name="dept" value="{$dept}" />
                    <input type="hidden" name="type" value="{$type}" />
                </form>
                </p>
                <div class="detail-content">
                    <h2>{$plan.name}</h2>
                    <div class="row">
                        <div class="col-lg-5 col-sm-5 progressBox">  
                            <form id="form-show">
                                <div class="plan_details">
                                    <h3>标记： <if condition="$plan['child_type'] neq 0">{$plan.child_type|getPlanType}<else/>无</if></h3>
                                    <if condition="$plan[child_type] eq 0">
                                        <div class="peo_jd">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label" style='width:auto;line-height:30px;'>选择标记</label>
                                                <div class="layui-input-block" style="margin-left:90px;">
                                                    <select name="child_type" class="layui-input">
                                                        <option value="0">请选择</option>
                                                        <foreach name="planFlag" item="pflag">
                                                            <option value="{$pflag.type_id}">{$pflag.type_name}</option>
                                                        </foreach>
                                                    </select>
                                                </div>
                                                <input type="hidden" class="getChildType" value="{:U('getChildType')}">
                                                <input type='hidden' class="currType" value="{$info.child_type|default=0}">
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label" style='width:auto;line-height:30px;'>增加标记</label>
                                                <div class="layui-input-block" style="margin-left:90px;">
                                                    <input type="text" name="add_type" autocomplete="off" class="layui-input" value="" />
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="text-align: center;">
                                                <input type="hidden" name="id" value="{$plan.plan_id}">
                                                <a class="layui-btn btn-submit ajax-post" data-url="{:U('show')}" data-form="show">确定</a>
                                            </div>
                                        </div>
                                    </if>
                                </div>
                            </form>
                            <div class="plan_details">
                                <h3>
                                    <span>进度</span>
                                    <div class="write fr" align='right'>
                                        <if condition="$is_write eq 1">
                                            <!--<if condition="$plan['sms_flag'] == 0">-->

                                            <span><a href="{:U('schedule',array('id'=>$plan['plan_id'],'type'=>$type))}"><i class="w1">&#xe69b;</i>写进度</a></span><span class="line"> | </span>
                                            <!--</if>-->
                                        </if>
                                        <span><a class="comment pointer" data-id="{$plan.plan_id}" data-type="{$type}"><i class="w2">&#xe69b;</i>写批注</a></span>
                                    </div>
                                </h3>
                                <p style='clear:both;'></p>
                                <div class="peo_jd">
                                    <foreach name='sums' item='sum'>
                                        <div class="xianshi">
                                            <label>{$sum.user|getChineseName}</label> 
                                            <div class="percent">
                                                <if condition="$pro['process'] neq '0%'">
                                                    <span class="inner" style='width:{$sum.percent}'></span>
                                                </if>
                                            </div>
                                            <span class="num">{$sum.percent|default='0%'}</span></div>
                                    </foreach> 
                                    <div class="xianshi">
                                        <label>总进度</label> 
                                        <div class="percent">
                                            <span class="inner2" style='width:{$total}%'></span> 
                                        </div>
                                        <span class="num">{$total|default='0'}%</span></div>
                                </div>
                            </div>
                            <table class="plan-more layui-table">
                                <tr>
                                    <td class="key">计划级别/类型</td>
                                    <td class="value">{$plan['level'] == 1 ? '个人级' : '部门级'}/{$plan.type|getPlanType}</td>
                                </tr>
                                <tr>
                                    <td class="key">汇报周期</td>
                                    <td class="value">{$plan.cycle|getPlanCycle}</td>
                                </tr>
                                <tr>
                                    <td class="key">计划内容</td>
                                    <td class="value">{$plan.content}</td>
                                </tr>
                                <if condition="$plan[type] neq 1">
                                    <tr>
                                        <td class="key">起止时间</td>
                                        <td class="value">{$plan.begin_date} 至 {$plan.end_date|default="无"}</td>
                                    </tr>
                                    <tr>
                                        <td class="key">开放部门</td>
                                        <td class="value"><if condition="$plan['to_id'] neq null">{$plan.to_id|getMoreDeptname}</if></td>
                                    </tr>
                                    <tr>
                                        <td class="key">开放人员</td>
                                        <td class="value">{$plan.to_person_id|getMoreUsername}</td>
                                    </tr>
                                    <tr>
                                        <td class="key">负责人</td>
                                        <td class="value">{$plan.manager|getMoreUsername}</td>
                                    </tr>
                                </if>
                                <tr>
                                    <td class="key">{$plan['type'] == 1 ? '执行人' : '参与人'}</td>
                                    <td class="value">{$plan.names}</td>
                                </tr>
                                <tr>
                                    <td class="key">创建人</td>
                                    <td class="value">{$plan.creator|getChineseName}</td>
                                </tr>
                                <tr>
                                    <td class="key">创建日期</td>
                                    <td class="value">{$plan.create_date}</td>
                                </tr>
                                <tr>
                                    <td class="key">标的物</td>
                                    <td class="value">
                                <foreach name="uploads" item="img" key="key">
                                    <div class="my-gallery" data-pswp-uid="1">
                                        <if condition="$img['is_pic'] eq 1">
                                            <img class="image" id="img{$key+1}" src="{$img.url}" width="50px">
                                            <else/>
                                            <a href="{$img.url}" download="{$img.name}" style="color: #5077AA;">{$img.name}</a>
                                        </if>
                                    </div>
                                </foreach>
                                </td>
                                </tr>
                                <tr>
                                    <td class="key">状态</td>
                                    <td class="value">{$plan['sms_flag']?'<font color="red"><b>已结束</b></font>':'<font color="green"><b>进行中</b></font>'}</td>
                                </tr>
                            </table>

                        </div>
                        <div class="col-lg-7 col-sm-7 progressDetailBox">   
                            <if condition="$plan['detail'] neq null or $plan['comment'] neq null">
                                <div class="plan_details">
                                    <h3>
                                        <span>进度详情</span>
                                        <div class="write fr">                                      
                                            <if condition="$is_edit eq 1">
                                                <span class="n2"><a href="{:U('showSchedule',array('id'=>$plan['plan_id'],'dept'=>$dept,'cType'=>$cType))}"><i class="w1">&#xe69b;</i>编辑</a></span>
                                            </if>
                                        </div>
                                    </h3>
                                    <div class="listWrap">
                                        <notempty name="plan.comment">
                                            <div class="notViewWrap">
                                                <div class="notView">
                                                    <div class="txt">
                                                        <foreach name='plan.comment' item='comment'>
                                                            <p>{$comment.progress|htmlspecialchars_decode}</p>
                                                            <div class="date">{$comment.writer|getChineseName}&nbsp;&nbsp;{$comment.write_time}</div>
                                                        </foreach>
                                                    </div>
                                                    <span class="showOrNot" state="show"><img src="/Public/Admin/images/arrow-up.png" /></span>
                                                    <div class="clear"></div> 
                                                </div>
                                            </div>
                                        </notempty>
                                        <foreach name='plan.detail' item='detail'>
                                            <div class="list_det cd-timeline-block">
                                                <dl>
                                                    <dt class="det1 title_1"><img src="/Public/Index/img/icon_0.svg" />{$detail.write_time}</dt>
                                                    <if condition="$detail['type_flag'] eq 1">
                                                        <dd class="det1"><span>批注</span></dd>
                                                        <else />
                                                        <dd class="det1">完成<span>{$detail.percent}%</span></dd>
                                                    </if>
                                                </dl>
                                                <dl class="det3">
                                                    <dt class="name">{$detail.writer|getChineseName}</dt>
                                                </dl>
                                                <dl>
                                                    <dt class="det2">             
                                                        <span class="det_nr">{$detail.progress|htmlspecialchars_decode}</span>
                                                    </dt>
                                                </dl>
                                                <if condition="$detail['file'] neq 0">
                                                    <dl>
                                                        <dt class="det2">
                                                            <p class="attach pointer" style="line-height: 1em;color:#5077AA">显示附件</p>
                                                            <div class="attach_lists" style="display:none">
                                                                <foreach name="detail.uploads" key="key" item="row">
                                                                    <if condition="$row['is_pic'] eq 0">
                                                                        <p style="border:0;line-height: 2em">
                                                                            <a href="{$row.upload}" download="{$row.name}">{$row.name}</a>
                                                                        </p>
                                                                        <else/>
                                                                        <img class="showImg" src="{$row.upload}" width="50px" style="margin-right:10px" />
                                                                    </if>
                                                                </foreach>
                                                            </div>
                                                        </dt>
                                                    </dl>
                                                </if>
                                                <if condition="$detail['location'] neq null">
                                                    <dl class="det4"> 
                                                        <i class="address">&#xe61a;</i><span>{$detail.location}</span> 
                                                    </dl>
                                                </if>
                                            </div>
                                        </foreach>
                                    </div>
                                </div>
                            </if>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <input type='hidden' id='ajaxlist' value='{$ajaxlist}' />
        <input type='hidden' id='type' value='{$type}' />
        <input type='hidden' id='smsFlag' value='{$smsFlag}' />
        <input type='hidden' id='dept' value='{$dept}' />
        <input type='hidden' id='follow' value='{$follow}' />
    </section>
    <div class="bigImg" style="position: absolute;"></div>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/Admin/js/plan.js"></script>  
    <script type="text/javascript" src="/Public/Admin/js/rotate.js" ></script>
    <script type="text/javascript" src="/Public/Admin/js/common.js" ></script>
    <script type="text/javascript">
        $(function () {
//            $(".progressDetailBox").css({"max-height":window.screen.availHeight-280+"px","overflow-y":"auto"});
            $(".progressDetailBox").css({"max-height": $(".progressBox").height() + "px", "overflow-y": "auto"});
            if ($('#ajaxlist').val() == 1) {
                var url = '/index.php/Home/Plan/lists?type=' + $('#type').val() + '&sms_flag=' + $('#smsFlag').val() + '&dept=' + $('#dept').val() + '&follow=' + $('#follow').val();
                $('.goback').attr('href', url);
            } else {
                if ($('#type').val() != 0) {
                    $('.goback').attr('href', $('.goback').attr('data-path'));
                } else {
                    //动态加返回参数
                    var data = $('#form').serialize();    //当前计划
                    var url = '/index.php/Home/Plan/index/p/1?' + data;
                    $('.goback').attr('href', url);
                }
            }
        })

//        $(initFlowStep())
        $(initSchedule())


    </script>
</block>